public class Solution2043 {

    long[] f;

    public Solution2043(long[] balance) {
        f=balance;
    }

    public boolean transfer(int account1, int account2, long money) {
        if (account1>f.length || account2>f.length){
            return false;
        }
        if (f[account1-1]<money){
            return false;
        }else{
            f[account2-1]+=money;
            f[account1-1]-=money;
            return true;
        }
    }

    public boolean deposit(int account, long money) {
        if (account>f.length){
            return false;
        }
        f[account-1]+=money;
        return true;
    }

    public boolean withdraw(int account, long money) {
        if (account>f.length){
            return false;
        }
        if (f[account-1]<money){
            return false;
        }else{
            f[account-1]-=money;
            return true;
        }
    }

    public static void main(String[] args) {
        Solution2043 solution2043=new Solution2043(new long[]{10, 100, 20, 50, 30});
        System.out.println(solution2043.withdraw(3, 10));
        System.out.println(solution2043.transfer(5, 1, 20));
        System.out.println(solution2043.deposit(5, 20));
        System.out.println(solution2043.transfer(3, 4, 15));
        System.out.println(solution2043.withdraw(10, 50));
    }
}
